@import '../../style/themes/index';
@import '../../style/mixins/index';
@import './mixin.less';

@drawer-prefix-cls: ~'@{cls-prefix}-drawer';

.@{drawer-prefix-cls} {
    .default();
    .text();
    &-open {
        position: fixed;
        overflow: hidden;
    }
    &-mask {
        .fixed-full();
        background: var(--f-mask-color);
    }

    &-container {
        .fixed-full();
        display: flex;
        cursor: not-allowed;
        pointer-events: auto;

        &.@{drawer-prefix-cls}-no-header {
            .@{drawer-prefix-cls}-wrapper {
                padding-top: @padding-lg;
            }
        }

        &.@{drawer-prefix-cls}-operable {
            cursor: auto;
            pointer-events: none;
        }

        &.@{drawer-prefix-cls}-mask-closable {
            cursor: auto;
        }
    }

    &-wrapper {
        position: relative;
        display: flex;
        flex-direction: column;
        box-sizing: border-box;
        background: var(--f-body-bg-color);
        border-radius: var(--f-border-radius-base);
        box-shadow: @shadow-down;
        cursor: auto;
        pointer-events: auto;
    }

    &-header {
        position: relative;
        display: flex;
        align-items: center;
        padding: @padding-md calc(@padding-md + @padding-xs);
        color: var(--f-head-color);
        font-weight: @font-weight-medium;
        font-size: @font-size-head;
        border-bottom: var(--f-border-width-base) var(--f-border-style-base)
            var(--f-border-color-split);

        .@{drawer-prefix-cls}-close {
            top: auto;
            line-height: 0;
        }
    }

    &-body-wrapper {
        flex: 1;
    }

    &-body-container {
        box-sizing: border-box;
        padding: @padding-md calc(@padding-md + @padding-xs);
        color: var(--f-sub-head-color);
        font-size: var(--f-font-size-base);
    }

    &-footer {
        padding: @padding-md calc(@padding-md + @padding-xs);
        text-align: left;
        .btn-margin {
            margin-right: @padding-md;
        }
        &-has-border {
            border-top: var(--f-border-width-base) var(--f-border-style-base)
                var(--f-border-color-split);
        }
    }

    &-close {
        position: absolute;
        top: 0;
        right: 0;
        padding: 0 @padding-lg;
        color: var(--f-sub-head-color);
        font-size: @font-size-head;
        line-height: 40px;
        cursor: pointer;
    }

    &-mask-fade-leave-active,
    &-mask-fade-enter-active {
        transition: opacity @animation-duration-slow @ease-base-in;
    }

    &-mask-fade-leave-to,
    &-mask-fade-enter-from {
        opacity: 0;
    }

    &-fade-leave-active,
    &-fade-enter-active {
        transition: all @animation-duration-slow @ease-base-out;
    }

    &-top {
        .@{drawer-prefix-cls}-fade-leave-to,
        .@{drawer-prefix-cls}-fade-enter-from {
            transform: translateY(-100%);
        }

        .@{drawer-prefix-cls}-container {
            align-items: flex-start;
        }

        .@{drawer-prefix-cls}-wrapper {
            border-top-left-radius: 0;
            border-top-right-radius: 0;
        }
    }

    &-right {
        .@{drawer-prefix-cls}-fade-leave-to,
        .@{drawer-prefix-cls}-fade-enter-from {
            transform: translateX(100%);
        }

        .@{drawer-prefix-cls}-container {
            justify-content: flex-end;
        }

        .@{drawer-prefix-cls}-wrapper {
            border-top-right-radius: 0;
            border-bottom-right-radius: 0;
        }
    }

    &-bottom {
        .@{drawer-prefix-cls}-fade-leave-to,
        .@{drawer-prefix-cls}-fade-enter-from {
            transform: translateY(100%);
        }

        .@{drawer-prefix-cls}-container {
            align-items: flex-end;
        }

        .@{drawer-prefix-cls}-wrapper {
            border-bottom-right-radius: 0;
            border-bottom-left-radius: 0;
        }
    }

    &-left {
        .@{drawer-prefix-cls}-fade-leave-to,
        .@{drawer-prefix-cls}-fade-enter-from {
            transform: translateX(-100%);
        }

        .@{drawer-prefix-cls}-container {
            justify-content: start;
        }

        .@{drawer-prefix-cls}-wrapper {
            border-top-left-radius: 0;
            border-bottom-left-radius: 0;
        }
    }

    &-drag {
        position: absolute;
        z-index: 999;
        display: flex;
        align-items: center;
        justify-content: center;

        @drag-icon-width: 6px;
        @drag-icon-height: 16px;
        @drag-icon-padding: 4px;
        @drag-area-width: calc(@drag-icon-width + @drag-icon-padding * 2);
        @drag-area-height: 100%;

        & > &-icon {
            display: flex;
            justify-content: space-between;
            width: @drag-icon-width;
            height: @drag-icon-height;
            
            &::before, &::after {
                width: 2px;
                height: 100%;
                background-color: var(--f-text-color-disabled);
                border-radius: 2px;
                content: '';
            }
        }

        &-top > &-icon, &-bottom > &-icon {
            transform: rotate(90deg);
        }

        &-left, &-right {
            width: @drag-area-width;
            height: @drag-area-height;
            cursor: col-resize;
        }

        &-left {
            top: 0;
            right: 0;
        }

        &-right {
            top: 0;
            left: 0;
        }

        &-top, &-bottom {
            width: @drag-area-height;
            height: @drag-area-width;
            cursor: row-resize;
        }

        &-top {
            bottom: 0;
            left: 0;
        }

        &-bottom {
            top: 0;
            left: 0;
        }
    }
}
